#ifndef ORDERRECORD_H
#define ORDERRECORD_H

#include "ASTM.h"
#include "ResultRecord.h"

#include <QDateTime>

class OrderRecord : public ASTM
{
public:
    // enum SampleType {
    //     Other = 0,
    //     Blood,
    //     BloodCell,
    //     Serum,
    //     CSF,
    //     Amniotic,
    //     Urethral,
    //     Saliva,
    //     Cervical
    // };

    enum ApplyType {
        Routine = 0,
        Specimen,
        Quality,
        ApplyUnknow
    };

    OrderRecord();

    // 构造用于发送测试结果(R)的OrderRecord
    OrderRecord(const QString &sampleId, const QString &sampleType, const QDateTime &sampleTime);

    QString buildRecord() const;
    bool analyzeRecord(const QString &str);
    void addResult(const ResultRecord &result);

public:
    int frameIndex = 1;
    /// 样本ID
    QString sampleID;
    /// 项目编号
    QString projectName;
    /// 稀释倍数
    double dilutionRate = 0;
    /// 重复测试次数
    int repeatNum = 1;
    /// 样本申请日期时间
    QString requestedDateTime;
    /// 样本类型
    QString sampleType;
    /// 申请类型
    ApplyType applyType = Routine;

    QList<ResultRecord> results;

private:
    // QStringList sampleTypeList{"Other", "Blood", "BloodCell", "Serum",
    //                            "CSF", "Amniotic", "Urethral", "Saliva", "Cervical"};
    QStringList applyTypeList{"R", "S", "Q", "U"};
};

#endif // ORDERRECORD_H
